@{
    bool fullContent = Model.String(Keys.RelativeFilePath) == $"{Context.String(DocsKeys.BlogPath)}/index.html" && Model.Get<int>(Keys.CurrentPage) == 1;
    foreach(IDocument post in Model.DocumentList(Keys.PageDocuments))
    {
        <h2><a href="@Context.GetLink(post)">@post.WithoutSettings.String(Keys.Title)</a></h2>
        @Html.Partial("_BlogPostDetails", post)
        @if(fullContent)
        {
            <div>
                @Html.Raw(post.Content)
            </div>
        }
        else
        {
            <div>
                @Html.Raw(post.String(HtmlKeys.Excerpt))
                <a href="@Context.GetLink(post)">Read more...</a>
            </div>
        }                  
        <hr />
        fullContent = false;
    }
    <nav>
        @{
            string directory = Model.FilePath(Keys.RelativeFilePath).Directory.FullPath;
        }
        <ul class="pager">
            <li class="previous">                
                @if(Model.Bool(Keys.HasPreviousPage))
                {
                    string previousPage = Context.GetLink(Model.Get<int>(Keys.CurrentPage) == 2
                        ? $"/{directory}" : $"/{directory}/page{Model.Get<int>(Keys.CurrentPage) - 1}");
                    <a href="@previousPage"><span aria-hidden="true">&larr;</span> Newer</a>
                }                
            </li>
            <li class="next">
                @if(Model.Bool(Keys.HasNextPage))
                {
                    string nextPage = Context.GetLink($"/{directory}/page{Model.Get<int>(Keys.CurrentPage) + 1}");
                    <a href="@nextPage">Older <span aria-hidden="true">&rarr;</span></a>
                }
            </li>
        </ul>
    </nav>
}